package com.xdwanj.smartcity.ui.home;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;

import com.xdwanj.smartcity.data.bean.BannerData;
import com.xdwanj.smartcity.data.bean.News;
import com.xdwanj.smartcity.data.repository.IHomeRepository;
import com.xdwanj.smartcity.data.repository.impl.HomeRepository;

import java.util.List;

public class HomeViewModel extends ViewModel {

    private LiveData<List<BannerData>> mBanners;
    private LiveData<List<News>> mNews;

    public HomeViewModel() throws Exception {
        IHomeRepository homeRepository = HomeRepository.getInstance();
        mBanners = homeRepository.listBannerByType(2,0,0);
        mNews = homeRepository.listNews(null,null,null,null,null);
    }

    public LiveData<List<BannerData>> getBanners() {
        return mBanners;
    }

    public LiveData<List<News>> getNews() {
        return mNews;
    }
}